<template>
  <el-col :span="8">
    <el-form-item :label="title">
      <el-select v-model="selectedOption" placeholder="请选择">
        <el-option
          v-for="option in options"
          :key="option.value"
          :label="option.label"
          :value="option.value"
        ></el-option>
      </el-select>
    </el-form-item>
  </el-col>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      default: "",
    },
    options: {
      type: Array,
      default: () => [],
    },
    value: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      selectedOption: this.value,
    };
  },
  watch: {
    value(newVal) {
      this.selectedOption = newVal;
    },
    selectedOption(newVal) {
      this.$emit("input", newVal);
    },
  },
};
</script>
<style lang="scss" scoped>
.el-form-item {
  width: 371px;
  .el-select {
    width: 70%;
  }
  ::v-deep .el-form-item__label {
    width: 96px;
  }
}
</style>
